package com.csj.DesignPattern.interpreter;


//能够更加方便实现一个新的表达式
public class Client {
    public static void main(String[] args) {
        Context context = new Context();
        Variable a = new Variable("a");
        Variable b = new Variable("b");
        Variable c = new Variable("c");
        Variable d = new Variable("d");

        context.add(a, 1);
        context.add(b, 2);
        context.add(c, 3);
        context.add(d, 4);

        AbstractExpression expression = new Minus(a, new Plus(new Minus(b, c), d));

        int result = expression.interpret(context);
        System.out.println(expression + "=" + result);

        String express = "(12 * 18) - (3 * 9)";
    }
}
